<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;

/* @var $this yii\web\View */
/* @var $searchModel app\models\search\AdPositionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '广告位管理';
$this->params['breadcrumbs'][] = $this->title;
?>
    <div class="nav-tabs-custom">
        <?= $this->render('_tab') ?>
        <div class="box">
            <div class="box-body">
                <?= GridView::widget([
                    'dataProvider' => $dataProvider,
                    'tableOptions' => ['class' => 'table table-bordered table-hover dataTable'],
                    /* 配置分页样式 */
                    'pager' => [
                        'options' => ['class' => 'pagination', 'style' => 'visibility: visible;'],
                        'nextPageLabel' => '下一页',
                        'prevPageLabel' => '上一页',
                        'firstPageLabel' => '第一页',
                        'lastPageLabel' => '最后页'
                    ],
                    'filterModel' => $searchModel,
                    'columns' => [
                        ['class' => 'app\core\lib\CheckboxColumn'],

                        'id',
                        'name',
                        'num',
                        'width',
                        'height',

                        [
                            'class' => 'app\core\lib\ActionColumn',
                            'template' => '{view} {update} {delete}',
                            'buttons' => [
                                'view' => function ($url, $model, $key) {
                                    return Html::a('<span class="fa fa-plus"></span> 广告位详情',
                                        ['ad/index', 'position_id' => $key],
                                        [
                                            'class' => 'btn btn-success btn-xs',
                                        ]
                                    );
                                },
                            ]
                        ],
                    ],
                ]); ?>
            </div>
        </div>
    </div>
<?php $delUrl = \yii\helpers\Url::toRoute(['delete']);
$this->render('@app/modules/admin/views/layouts/modal-delete', ['delUrl' => $delUrl]); ?>